package com.pj.compose.ui.compose

import androidx.annotation.DrawableRes
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import com.pj.compose.R
import com.pj.compose.ui.theme.c3367D5
import com.pj.compose.ui.theme.c666666


@Composable
fun BottomIcon(@DrawableRes id:Int, colorList:List<Color>,isSelect:Boolean = false , contentDescription:String? = ""){
    // 0 常规颜色 1 选中颜色
    Icon(
        painter = painterResource(id = id),
        contentDescription = contentDescription,
        tint = colorList[if (isSelect) 1 else 0]
    )
}

@Preview
@Composable
fun BottomIconPreview(){
    BottomIcon(R.drawable.ic_tab_widget,listOf(c666666, c3367D5))
}